:root {
  --white: #ffffff;
  --light-blue: #e3f2fd;
  --blue-100: #bbdefb;
  --blue-200: #90caf9;
  --blue-300: #64b5f6;
  --blue-400: #42a5f5;
  --blue-500: #2196f3;
  --black: #212121;
  --grey-100: #f5f5f5;
  --grey-200: #eeeeee;
  --grey-300: #e0e0e0;
  --grey-400: #bdbdbd;
  --grey-500: #9e9e9e;
  --error-red: #ff3333;
  --success-green: #4caf50;
  --warning-orange: #ff9800;
  --accent-teal: #009688;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Arial", sans-serif;
  background-color: var(--light-blue);
  color: var(--black);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  padding: 2rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--blue-200);
  border-top-color: var(--blue-500);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 1.5rem;
  color: var(--black);
  margin-bottom: 0.5rem;
}

.loading-subtext {
  color: var(--grey-500);
}

.header {
  background-color: var(--white);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  color: var(--black);
  font-size: 1.5rem;
  font-weight: bold;
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav a {
  color: var(--black);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.3s, transform 0.2s;
}

.nav a:hover,
.nav a.active {
  background-color: var(--light-blue);
  transform: translateY(-2px);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.notifications {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  font-size: 1.2rem;
  color: var(--grey-500);
  transition: color 0.3s ease;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: var(--error-red);
  color: white;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 10px;
}

.profile-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.profile-pic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 80px 20px 40px;
  margin: 72px auto 2rem;
  max-width: 1200px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.profile-grid {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 2rem;
  margin-top: 2rem;
}

/* Profile Sidebar */
.profile-sidebar {
  background-color: var(--white);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.profile-header {
  text-align: center;
  margin-bottom: 2rem;
}

.profile-image {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin-bottom: 1rem;
  border: 4px solid var(--blue-100);
  padding: 4px;
  display: block; 
  margin-left: auto; 
  margin-right: auto; 
}

.profile-header { /* Parent of profile-image and upload-overlay */
  text-align: center;
  margin-bottom: 2rem;
  position: relative; /* Needed for absolute positioning of the overlay */
}

.upload-overlay {
  position: absolute;
  top: 0; /* Align with the top of the profile-header */
  /* Calculate left position to center overlay over the image */
  /* Assuming profile-image is 150px wide and centered in profile-header */
  left: calc(50% - 75px); /* (profile-header width / 2) - (overlay width / 2) */
  width: 150px;  /* Match image width */
  height: 150px; /* Match image height */
  border-radius: 50%; /* Match image shape */
  background-color: rgba(0, 0, 0, 0.5);
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-size: 0.9rem;
  /* Ensure it's above the image if there are z-index issues, though usually not needed here */
}

.profile-header:hover .upload-overlay {
  opacity: 1;
}

.upload-overlay i {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.profile-name {
  font-size: 1.5rem;
  color: var(--black);
  margin-bottom: 0.5rem;
}

.profile-status {
  color: var(--blue-500);
  font-weight: 500;
}

.profile-stats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: var(--grey-100);
  border-radius: 8px;
  transition: transform 0.3s ease;
}

.stat-item:hover {
  transform: translateX(5px);
  background-color: var(--blue-100);
}

.stat-item i {
  color: var(--blue-500);
}

/* Form Container */
.form-container {
  background-color: var(--white);
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  width: 100%;
  transition: transform 0.3s ease;
}

.form-container:hover {
  transform: translateY(-4px);
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--blue-500);
  font-size: 2rem;
  position: relative;
  padding-bottom: 1rem;
}

h1::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background-color: var(--blue-300);
  border-radius: 2px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.inputForm {
  position: relative;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--grey-500);
  transition: color 0.3s ease;
}

.toggle-password:hover {
  color: var(--blue-500);
}

label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--grey-500);
  font-weight: 500;
}

label i {
  color: var(--blue-500);
}

input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--grey-200);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background-color: var(--white);
}

input:hover {
  border-color: var(--blue-200);
}

input:focus {
  outline: none;
  border-color: var(--blue-400);
  box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.1);
}

.credits-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
}

.credit-history {
  font-size: 0.875rem;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.trend.positive {
  color: var(--success-green);
  background-color: rgba(76, 175, 80, 0.1);
}

.buy-credits-btn {
  background: none;
  border: none;
  color: var(--blue-500);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.3s ease;
}

.buy-credits-btn:hover {
  color: var(--blue-400);
}

.change-password-btn {
  background: none;
  border: none;
  color: var(--blue-500);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  transition: all 0.3s ease;
}

.change-password-btn:hover {
  color: var(--blue-400);
  transform: translateX(5px);
}

.action-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.primary-button,
.secondary-button {
  flex: 1;
  padding: 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.primary-button {
  background-color: var(--blue-500);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.primary-button:hover {
  background-color: var(--blue-400);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4);
}

.secondary-button {
  background-color: var(--grey-100);
  color: var(--black);
}

.secondary-button:hover {
  background-color: var(--grey-200);
  transform: translateY(-2px);
}

.danger-button {
  flex: 1;
  padding: 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  background-color: var(--error-red);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(255, 51, 51, 0.3);
}

.danger-button:hover {
  background-color: #d32f2f; /* Darker red */
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 51, 51, 0.4);
}


/* Profile Activity */
.profile-activity {
  background-color: var(--white);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.profile-activity h3 {
  color: var(--black);
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--grey-100);
  border-radius: 8px;
  transition: transform 0.3s ease;
}

.activity-item:hover {
  transform: translateX(5px);
  background-color: var(--blue-100);
}

.activity-item i {
  color: var(--blue-500);
  font-size: 1.25rem;
}

.activity-content p {
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.activity-content span {
  font-size: 0.875rem;
  color: var(--grey-500);
}

.footer {
  background-color: var(--white);
  padding: 3rem 0 1rem;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-section h3 {
  color: var(--black);
  margin-bottom: 1rem;
}

.footer-section a {
  color: var(--black);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-section a:hover {
  color: var(--blue-400);
}

.social-links {
  display: flex;
  gap: 1rem;
}

.footer-bottom {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--grey-200);
}


.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  padding: 2rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--blue-200);
  border-top-color: var(--blue-500);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 1.5rem;
  color: var(--black);
  margin-bottom: 0.5rem;
}

.loading-subtext {
  color: var(--grey-500);
}

@media (max-width: 1200px) {
  .profile-grid {
    grid-template-columns: 250px 1fr;
  }

  .profile-activity {
    grid-column: span 2;
  }
}

@media (max-width: 992px) {
  .profile-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .profile-activity {
    grid-column: auto;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .nav {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }

  .user-menu {
    justify-content: center;
  }

  .container {
    padding: 1rem;
  }

  .form-container {
    padding: 2rem;
  }

  .action-buttons {
    flex-direction: column;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-section {
    align-items: center;
  }

  .social-links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .nav {
    gap: 0.5rem;
  }

  .nav a {
    padding: 0.5rem;
  }

  .form-container {
    padding: 1.5rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  input {
    padding: 0.75rem;
  }

  .primary-button,
  .secondary-button {
    padding: 0.875rem;
  }
}
